package pojo;

public class Hello2 {
    private String str;

//    public Hello2(){
//        System.out.println("Hello2无参构造被创建");
//    }

    //有参构造 如果要用有参构造创建对象
    public Hello2(String str){
        System.out.println("Hello2有参构造"+str);
    }


    public String getStr() {
        return str;
    }
    public void setStr(String str) {
        this.str = str;
    }
    public void display(){
        System.out.println("str2="+str);
    }
    @Override
    public String toString() {
        return "Hello{" +
                "str='" + str + '\'' +
                '}';
    }
}
